package com.jk.bgmessage.controller;

import com.jk.bgmessage.entity.MessageEntity;
import com.jk.bgmessage.service.MessageService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import java.util.HashMap;

@RestController
@RequestMapping("message")
public class MessageController {
    @Autowired
    private MessageService messageService;

    /**
     *
     * @return
     */
    @RequestMapping(value = "selectAllMessage",method = RequestMethod.POST)
    public HashMap<String,Object> selectAllMessage(MessageEntity messageEntity){
        return messageService.selectAllMessage(messageEntity);
    }

    @RequestMapping("delOneMessage")
    public void delOneMessage(Integer inforId){
        messageService.delOneMessage(inforId);
    }

    @RequestMapping("updateSelMessage")
    public MessageEntity updateSelMessage(Integer inforId){
        return messageService.updateSelMessage(inforId);
    }

    @RequestMapping(value = "addOrUpdate",method = RequestMethod.POST)
    public String addOrUpdate(MessageEntity messageEntity){
        return messageService.addOrUpdate(messageEntity);
    }
}
